<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //正则表达式通常用于匹配  替换  提取
        //正则表达式以对象形式存在

        //1.通过RegExp对象创建
        var regexp = new RegExp(/123/);

        //2.通过字面量创建
        var re = /123/;

        //3.用test检测是否符合正则表达式要求的规范
        console.log(re.test(123));
        console.log(re.test(123454234));//只要包含123返回的结果都是true
        console.log(re.test('abc'));
    </script>
</body>

</html>